<?PHP

	include("includes/config.php");
	include("includes/forum/topic.class.php");
	include("includes/forum/post.class.php");
	$topic=new topic();
	$post=new post();
	
	if($_SESSION['logged_in']==1){
		$variableStack['login_id'] = "nav_logout";
		$variableStack['login_href'] = "logout";
	} else {
		$variableStack['login_id'] = "nav_login";
		$variableStack['login_href'] = "login";
	}
	$spotId = $config->getVal($db, 'spotlight_thread');
	$variableStack['spotlight_id']=$spotId;
	$topicRes = $topic->getTopic($db,$spotId);
	if(mysql_num_rows($topicRes)==0){
		$variableStack['spotlight']="No spotlight has been set :(";
	} else {
		$postRes = $post->getPost($db, mysql_result($topicRes, 0, 'topic_first_post_id'));
		if(mysql_num_rows($topicRes)==0){
			$variableStack['spotlight']="Permission error";
		} else {
			$variableStack['spotlight']=mysql_result($postRes, 0, 'post_content_html');
		}
	}
	$html = file_get_contents('styles/'.$activeStyle.'/t/index.html');
	$outHtml = parseHtml($html, $variableStack);	
	echo $outHtml;
	

?>